home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / mallcrawl.swf / scripts / __Packages / mx / controls / scrollClasses / ScrollThumb.as < prev   
Encoding:
Text File  |  2007-09-28  |  2.4 KB  |  92 lines

  1. class mx.controls.scrollClasses.ScrollThumb extends mx.skins.CustomBorder
  2. {
  3.    var ymin;
  4.    var ymax;
  5.    var datamin;
  6.    var datamax;
  7.    var scrollMove;
  8.    var lastY;
  9.    var onMouseMove;
  10.    var grip_mc;
  11.    var gripSkin;
  12.    static var symbolOwner = mx.skins.CustomBorder.symbolOwner;
  13.    var className = "ScrollThumb";
  14.    var btnOffset = 0;
  15.    var horizontal = false;
  16.    var idNames = new Array("l_mc","m_mc","r_mc","grip_mc");
  17.    function ScrollThumb()
  18.    {
  19.       super();
  20.    }
  21.    function createChildren(Void)
  22.    {
  23.       super.createChildren();
  24.       this.useHandCursor = false;
  25.    }
  26.    function setRange(_ymin, _ymax, _datamin, _datamax)
  27.    {
  28.       this.ymin = _ymin;
  29.       this.ymax = _ymax;
  30.       this.datamin = _datamin;
  31.       this.datamax = _datamax;
  32.    }
  33.    function dragThumb(Void)
  34.    {
  35.       this.scrollMove = this._ymouse - this.lastY;
  36.       this.scrollMove += this._y;
  37.       if(this.scrollMove < this.ymin)
  38.       {
  39.          this.scrollMove = this.ymin;
  40.       }
  41.       else if(this.scrollMove > this.ymax)
  42.       {
  43.          this.scrollMove = this.ymax;
  44.       }
  45.       this._parent.isScrolling = true;
  46.       this._y = this.scrollMove;
  47.       var _loc2_ = Math.round((this.datamax - this.datamin) * (this._y - this.ymin) / (this.ymax - this.ymin)) + this.datamin;
  48.       this._parent.scrollPosition = _loc2_;
  49.       this._parent.dispatchScrollEvent("ThumbTrack");
  50.       updateAfterEvent();
  51.    }
  52.    function stopDragThumb(Void)
  53.    {
  54.       this._parent.isScrolling = false;
  55.       this._parent.dispatchScrollEvent("ThumbPosition");
  56.       this._parent.dispatchScrollChangedEvent();
  57.       delete this.onMouseMove;
  58.    }
  59.    function onPress(Void)
  60.    {
  61.       this._parent.pressFocus();
  62.       this.lastY = this._ymouse;
  63.       this.onMouseMove = this.dragThumb;
  64.       super.onPress();
  65.    }
  66.    function onRelease(Void)
  67.    {
  68.       this._parent.releaseFocus();
  69.       this.stopDragThumb();
  70.       super.onRelease();
  71.    }
  72.    function onReleaseOutside(Void)
  73.    {
  74.       this._parent.releaseFocus();
  75.       this.stopDragThumb();
  76.       super.onReleaseOutside();
  77.    }
  78.    function draw()
  79.    {
  80.       super.draw();
  81.       if(this.grip_mc == undefined)
  82.       {
  83.          this.setSkin(3,this.gripSkin);
  84.       }
  85.    }
  86.    function size()
  87.    {
  88.       super.size();
  89.       this.grip_mc.move((this.width - this.grip_mc.width) / 2,(this.height - this.grip_mc.height) / 2);
  90.    }
  91. }
  92.